<template>
  <div>
    <el-form ref="form" :model="form" label-width="80px">
      <el-form-item label="患者名称">
        <el-input v-model="form.name"></el-input>
      </el-form-item>
      <el-form-item label="身份证号">
        <el-input v-model="form.idNumber"></el-input>
      </el-form-item>
      <el-form-item label="手机号码">
        <el-input v-model="form.phone"></el-input>
      </el-form-item>
      <el-form-item label="服务包">
        <el-select v-model="form.servicePack" placeholder="请选择服务">
          <el-option label="0-6岁儿童服务包" value="1"></el-option>
          <el-option label="老年人服务包" value="2"></el-option>
          <el-option label="慢性病护理包" value="3"></el-option>
        </el-select> </el-form-item
      ><el-form-item label="服务项目">
        <el-select v-model="form.servicesAvailable" placeholder="请选择服务">
          <el-option label="随访服务" value="1"></el-option>
          <el-option label="血糖检测" value="2"></el-option>
          <el-option label="血压检测" value="3"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="申请时间">
        <el-col :span="11">
          <el-date-picker
            type="date"
            placeholder="选择日期"
            v-model="form.applicationDate"
            style="width: 100%"
            format="yyyy-MM-dd"
        value-format="yyyy-MM-dd"
          ></el-date-picker>
        </el-col>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">立即创建</el-button>
        <el-button>取消</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
import axios from "axios";
export default {
  data() {
    return {
      form: {
        name: "",
        idNumber: "",
        phone: "",
        servicePack: 0,
        servicesAvailable: 0,
        applicationDate: "",
      },
    };
  },
  methods: {
    onSubmit() {
      axios({
        url: "/api/med/addMySqlMed",
        params: {
          name: this.form.name,
          idNumber: this.form.idNumber,
          phone: this.form.phone,
          servicePack: this.form.servicePack,
          servicesAvailable: this.form.servicesAvailable,
          applicationDate: this.form.applicationDate,
        },
      }).then((res) => {
        console.log(res);
         this.$router.replace("/pending");
      });
    },
  },
};
</script>

<style>
</style>